<%--
  Created by IntelliJ IDEA.
  User: admin
  Date: 2025/8/22
  Time: 11:57
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script src="http://code.jquery.com/jquery-2.1.4.min.js"></script>
</head>
<body>
<button id="btn1">发送json格式User数据</button>
<button id="btn2">发送json格式UserList数据</button>
</body>
<script>
    document.getElementById("btn1").onclick=function (){
        var UserData={"username":"zhaoliu","age":19,"id":1};
        $.ajax({
            type:"POST",
            url:"/arg4",
            data:JSON.stringify(UserData),
            contentType:"application/json;charset=utf-8"
        });
    }


    document.getElementById("btn2").onclick=function (){
        var userList = new Array();
        userList.push({username:"zhangsan",age:18});
        userList.push({username:"lisi",age:28});

        $.ajax({
            type:"POST",
            url:"/arg6",
            data:JSON.stringify(userList),
            contentType:"application/json;charset=utf-8"
        });
    }


</script>
</html>
